-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix two types of Clazy warnings #5807
Conversation
99cbb70
to
b530f32
Compare
This saves memory allocations. Found by Clazy (qstring-arg).
Only include classes that are actually used. Do not pull in all internal dependencies. Found by Clazy (no-module-include).
b530f32
to
2423aef
Compare
It appears multi-arg only works when the arguments are The GUI now reports error to the terminal (see https://trac.cppcheck.net/ticket/12316):
The code in question is in QString bgcolor = QString("background:rgb(%1,%2,%3);")
.arg(mWidgetStyle->widgetBGColor.red(),
mWidgetStyle->widgetBGColor.green(),
mWidgetStyle->widgetBGColor.blue()); All of the arguments are This is with Qt5 though. I have not checked if Qt6 has additional overloads. |
Qt6 has a varargs overload but that also only works with strings. From https://doc.qt.io/qt-6/qstring.html#arg-14:
|
It sounds like the clazy check should detect exactly this kind of misuse that we have now: |
I thought about that but it doesn't offer that much of interest and has several false positives. My IDE supports Clazy but it seems I am not able to specify the extra option. |
@gruenich Can you revert the |
I'd prefer a partial revert to get it running on Ubuntu 20.04, too. Focal provides an older version of Qt 5.12 which might lack some features. |
Reverted in #5902. |
Chained QString::arg, replace inclusion of QtCore